<template>
  <TypeIcon :name="data.imageName" :config="data.config"></TypeIcon>
</template>

<script lang="ts" setup>
import TypeIcon from './TypeIcon.vue'
import { reactive } from 'vue'
import { TargetType } from '@/ts/core'
type Props = {
  size?: number
  iconType: string
}
const props = defineProps<Props>()
const loadIcon = (type: string) => {
  switch (type) {
    case '加用户':
    case '加人员':
      return 'types/joinFriend'
    case '加群组':
      return 'types/joinCohort'
    case '加单位':
    case '加大学':
    case '加医院':
      return 'types/joinCompany'
    case '加存储资源':
      return 'types/joinStorage'
    case '加组织群':
      return 'types/joinGroup'
    case '动态':
      return 'types/activity'
    case '目录':
      return 'types/directory'
    case '成员目录':
      return 'types/cohort'
    case '字典':
      return 'types/dictionary'
    case '分类':
      return 'types/species'
    case '分类项':
      return 'types/workSend'
    case '属性':
      return 'types/property'
    case '应用':
      return 'types/application'
    case '模块':
      return 'types/module'
    case '序列':
      return 'types/sequence'
    case '办事':
    case '集群模板':
      return 'types/work'
    case '视图':
      return 'types/viewData'
    case '表单':
      return 'types/form'
    case '角色':
      return 'types/identity'
    case '权限':
      return 'types/authority'
    case '激活':
      return 'operate/setActive'
    case '事项':
      return 'types/apply'
    case '迁移配置':
      return 'types/transfer'
    case '页面模板':
      return 'types/page'
    case '商城模板-数据':
      return 'types/mallData'
    case '商城模板-实体':
      return 'types/mallPhysical'
    case '打印模板':
    case '文档模板':
      return 'types/print'
    case '报表树':
      return 'types/reportTree'
    case '任务':
      return 'types/task'
    case '子流程':
    case 'setCluster':
      return 'types/workSend'
    case TargetType.Group:
      return 'types/group'
    case TargetType.Company:
      return 'types/company'
    case TargetType.Storage:
      return 'types/storage'
    case TargetType.Station:
      return 'types/station'
    case TargetType.Cohort:
      return 'types/cohort'
    case TargetType.Section:
      return 'types/section'
    case TargetType.Department:
      return 'types/department'
    case TargetType.College:
      return 'types/college'
    case TargetType.Laboratory:
      return 'types/laboratory'
    case TargetType.Office:
      return 'types/office'
    case TargetType.Research:
      return 'types/research'
    case TargetType.Working:
      return 'types/working'
    case TargetType.Person:
      return 'types/person'
    case 'newDir':
      return 'operate/newDir'
    case 'refresh':
      return 'operate/refresh'
    case 'remark':
      return 'operate/remark'
    case 'open':
      return 'operate/open'
    case 'design':
      return 'operate/design'
    case 'copy':
      return 'operate/copy'
    case 'move':
      return 'operate/move'
    case 'parse':
      return 'operate/parse'
    case 'rename':
      return 'operate/rename'
    case 'download':
      return 'operate/download'
    case 'delete':
      return 'operate/delete'
    case 'hardDelete':
      return 'operate/hardDelete'
    case 'shortcut':
      return 'operate/shortcut'
    case 'restore':
      return 'operate/restore'
    case 'remove':
      return 'operate/removeMember'
    case 'update':
      return 'operate/update'
    case 'pull':
      return 'operate/pullMember'
    case 'joinFriend':
      return 'operate/joinFriend'
    case 'joinCohort':
      return 'operate/joinCohort'
    case 'joinCompany':
      return 'operate/joinCompany'
    case 'joinStorage':
      return 'operate/joinStorage'
    case 'joinDepartment':
      return 'operate/joinDepartment'
    case 'joinGroup':
      return 'operate/joinGroup'
    case 'qrcode':
      return 'operate/qrcode'
    case 'newCohort':
      return 'operate/newCohort'
    case 'newCompany':
      return 'operate/newCompany'
    case 'newStorage':
      return 'operate/newStorage'
    case 'newGroup':
      return 'operate/newGroup'
    case 'newDepartment':
      return 'operate/newDepartment'
    case 'newApp':
      return 'operate/newApplication'
    case 'newModule':
      return 'operate/newModule'
    case 'newProperty':
      return 'operate/newProperty'
    case 'newForm':
    case 'newView':
      return 'operate/newForm'
    case 'newWork':
      return 'operate/newWork'
    case 'newDict':
      return 'operate/newDict'
    case 'newSpecies':
      return 'operate/newSpecies'
    case 'newPage':
      return 'operate/newPage'
    case 'newTransfer':
      return 'operate/newTransfer'
    case 'newFile':
      return 'operate/uploadFile'
    case 'copyRevision':
      return 'operate/copyRevision'
    case 'lookRevision':
      return 'operate/lookRevision'
    case 'lookSubscribe':
      return 'operate/lookSubscribe'
    case 'subscribe':
      return 'operate/subscribeUpdate'
    case 'subscribeUpdate':
      return 'operate/subscribeUpdate'
    case 'settingStation':
      return 'types/station'
    case 'taskList':
      return 'operate/taskList'
    case 'selectChat':
      return 'operate/selectChat'
    case 'openChat':
      return 'operate/openChat'
    case 'setReaded':
      return 'operate/setReaded'
    case 'setNoReaded':
      return 'operate/setNoReaded'
    case 'setPageTab':
    case 'setCommon':
    case 'setToping':
      return 'operate/setCommon'
    case 'delPageTab':
    case 'delCommon':
    case 'removeToping':
      return 'operate/delCommon'
    case 'distribute':
      return 'operate/distribute'
    case 'hslSplit':
      return 'operate/hslSplit'
    case 'importStandard':
      return 'operate/importStandard'
    case 'importBusiness':
      return 'operate/importBusiness'
    case 'fullScreen':
      return 'operate/fullScreen'
    case 'centerScreen':
      return 'operate/centerScreen'
    case 'check':
      return 'operate/check'
    case 'close':
      return 'operate/close'
    case 'newReportTree':
      return 'operate/newReportTree'
    case 'genSpecies':
      return 'operate/genSpecies'
    case 'setHomeTop':
      return 'operate/setHomeTop'
    case 'delHomeTop':
      return 'operate/delHomeTop'
    case 'application/pdf':
      return 'types/files/pdf'
    case 'application/x-zip-compressed':
      return 'types/files/compressed'
    case 'application/vnd.ms-powerpoint':
    case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
      return 'types/files/powerpoint'
    case 'application/vnd.ms-excel':
    case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
      return 'types/files/excel'
    case 'application/msword':
    case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
      return 'types/files/word'
  }
  if (type?.startsWith('application')) {
    return 'types/files/application'
  } else if (type?.startsWith('video')) {
    return 'types/files/video'
  } else if (type?.startsWith('image')) {
    return 'types/files/picture'
  } else if (type?.startsWith('text')) {
    return 'types/files/text'
  } else if (type?.startsWith('audio')) {
    return 'types/files/audio'
  }
  return 'types/files/unknown'
}
const iconSize = props.size || 60
const data = reactive<{
  imageName: string
  config: any
}>({
  imageName: loadIcon(props.iconType),
  config: { size: iconSize, color: '#366EF4' }
})
</script>

<style lang="scss"></style>
